import { ADD, SUBTRACT } from "./contents";

function countReducer(state = 0, action) {
  const { type, data } = action;
  switch (type) {
    case ADD:
      return (state = state + data);
    case SUBTRACT:
      return (state = state - data);
    default:
      return state;
  }
}

export default countReducer;

